package accountinfo.dao;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;

public class AccountDetail {

	String cardNO;
	String lastStatementDT;
	String titleDS;
	String firstNM;
	String lastNM;
	String basicCardIN;
	String cardSinceDT;
	String nationalID;
	String birthDT;
	String memberSinceDT;
	String vipStatusIN;
	List<AddressInfo> addresses;
	private String emailAddress;

	public AccountDetail(String cardNO, String lastStatementDT, String titleDS,
			String firstNM, String lastNM, String basicCardIN,
			String cardSinceDT, String emailAddress, String birthDT,
			String memberSinceDT, String vipStatusIN, AddressInfo address,
			AddressInfo address2) {
		super();
		this.cardNO = cardNO;
		this.lastStatementDT = lastStatementDT;
		this.titleDS = titleDS;
		this.firstNM = firstNM;
		this.lastNM = lastNM;
		this.basicCardIN = basicCardIN;
		this.cardSinceDT = cardSinceDT;
		this.emailAddress = emailAddress;
		this.birthDT = birthDT;
		this.memberSinceDT = memberSinceDT;
		this.vipStatusIN = vipStatusIN;
		this.addresses = new ArrayList<AddressInfo>();

		if (address2 != null)
			this.addresses.add(0, address2);
		if (address != null)
			this.addresses.add(0, address);
		
	}

	public List<AddressInfo> getAddresses() {
		return addresses;
	}

	public Map<String, Object> getAddressMap() {

		final Map<String, Object> ret = new HashMap<String, Object>();
		final List<Map<String, String>> addresses = new LinkedList<Map<String, String>>();
		ret.put("addresses", addresses);

		if (!this.addresses.isEmpty()) {
			for (AddressInfo item : this.addresses) {
				final Map<String, String> address = new HashMap<String, String>();
				address.put("purpose", item.purpose);
				address.put("iso3countryCD", item.iso3countryCD);
				address.put("postalCD", item.postalCD);
				address.put("addressline1", item.addressline1);
				address.put("addressline2", item.addressline2);
				address.put("addressline3", item.addressline3);
				address.put("cityNM", item.cityNM);
				addresses.add(address);
			}
		}
		return ret;
	}

	public void addAddress(AddressInfo address) {
		this.addresses.add(0, address);
	}

	public String getCardNO() {
		return cardNO;
	}

	public void setCardNO(String cardNO) {
		this.cardNO = cardNO;
	}

	public String getLastStatementDT() {
		return lastStatementDT;
	}

	public void setLastStatementDT(String lastStatementDT) {
		this.lastStatementDT = lastStatementDT;
	}

	public String getTitleDS() {
		return titleDS;
	}

	public void setTitleDS(String titleDS) {
		this.titleDS = titleDS;
	}

	public String getFirstNM() {
		return firstNM;
	}

	public void setFirstNM(String firstNM) {
		this.firstNM = firstNM;
	}

	public String getLastNM() {
		return lastNM;
	}

	public void setLastNM(String lastNM) {
		this.lastNM = lastNM;
	}

	public String getBasicCardIN() {
		return basicCardIN;
	}

	public void setBasicCardIN(String basicCardIN) {
		this.basicCardIN = basicCardIN;
	}

	public String getCardSinceDT() {
		return cardSinceDT;
	}

	public void setCardSinceDT(String cardSinceDT) {
		this.cardSinceDT = cardSinceDT;
	}

	public String getEmailAddress() {
		return emailAddress;
	}

	public void setEmailAddress(String emailAddress) {
		this.emailAddress = emailAddress;
	}

	public String getBirthDT() {
		return birthDT;
	}

	public void setBirthDT(String birthDT) {
		this.birthDT = birthDT;
	}

	public String getMemberSinceDT() {
		return memberSinceDT;
	}

	public void setMemberSinceDT(String memberSinceDT) {
		this.memberSinceDT = memberSinceDT;
	}

	public String getVipStatusIN() {
		return vipStatusIN;
	}

	public void setVipStatusIN(String vipStatusIN) {
		this.vipStatusIN = vipStatusIN;
	}

}
